<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // function countTime(time) {
    //   let hour = 1, minute = 1;
    //   const digit = time

    //   if (digit[0] == '?' && digit[1] == '?') hour = 24;
    //   else if (digit[0] == '?') hour = (digit[1] <= '3') ? 3 : 2;
    //   else if (digit[1] == '?') hour = (digit[0] <= '1') ? 10 : 4;

    //   if (digit[3] == '?' && digit[4] == '?') minute = 60;
    //   else if (digit[3] == '?') minute = 6;
    //   else if (digit[4] == '?') minute = 10;

    //   return hour * minute;

    // };
    function countTime(time) {
      let l = 1, r = 1
      if (time[0] === '?') l = time[1] === '?' ? 24 : +time[1] < 4 ? 3 : 2
      else if (time[1] === '?') l = +time[0] < 2 ? 10 : 4
      if (time[3] === '?') r = time[4] === '?' ? 60 : 6
      else if (time[4] === '?') r = 10
      return l * r
    };
    console.log(countTime("?5:00"));
  </script>
</body>

</html>